if (!jsx3.lang.Class.forName("ux.cdb.admin.queries.insideOrgan.Query")) {
    
jsx3.Class.defineClass(
    "ux.cdb.admin.queries.insideOrgan.Query", jsx3.gui.Block, [],
    function (query) {
		query.prototype.initialize = function(){
				var me = this;
				this.matrix = this.get('mtxMain');
/* @JSC :: begin DEBUG */
				jsx3.log('insideOrgan#initialize : Begin binding PageWheel ...');
/* @JSC :: end */
				
				this.pageSize = 20;
				this.totalRecordCount = 100;
				this.currentPage = 1;
				this.totalPages = 1; 
				this.pageLoaded = false;
				
                this.pagebar = this.get("blkPageWheel");
				
				setTimeout(function(){
					me.loadInsideOrganList();
				},10);
		};
		
		query.prototype.loadInsideOrganList = function() {
/* @JSC :: begin DEBUG */
			jsx3.log('loadInsideOrganList pageSize:' + this.pageSize);
/* @JSC :: end */
			ux.megatron.util.Dwr.callDwr("GetInternalOrgUCC","getInternalOrgInfoList",[this.currentPage, this.pageSize], this,
				function(_data){
					if (_data != null && typeof _data == 'object') {
						this.setMatrixList(_data);
/* @JSC :: begin DEBUG */
						jsx3.log('GetInternalOrgUCC#getInternalOrgInfoList data : '+dwr.util.toDescriptiveString(_data, 5));
/* @JSC :: end */
					}
				});
		};
		
		query.prototype.setMatrixList = function(data) {
			if(data && data instanceof Object) {
				var tmpCDF = jsx3.xml.CDF.Document.newDocument();
				this.loadPageControler(data.content.page.count); 
				var records = data.content.data;
/* @JSC :: begin DEBUG */
				jsx3.log("insideOrgan#setMatrixList : records : " + dwr.util.toDescriptiveString(records, 5));
/* @JSC :: end */
				for(var i=0,record;record=records[i];i++){
					var jsxid = record.partyId ? record.partyId : i;
					tmpCDF.insertRecord(record,null,false).setAttribute('jsxid',jsxid);
				}
/* @JSC :: begin DEBUG */
				jsx3.log("insideOrgan#setMatrixList : CDF : " + tmpCDF);
/* @JSC :: end */
				
				this.matrix.setSourceXML(tmpCDF);
				this.matrix.repaintData();
			} else {
				jsx3.log('insideOrgan#setMatrixList cdf data of matrix:' + data);
			}
		};
		
		query.prototype.loadPageControler = function(count) {
			jsx3.log('insideOrgan#loadPageControler count['+count+']');
			this.totalRecordCount = count;
			this.totalPages = (count%this.pageSize>0) ? (parseInt(count/this.pageSize, 10) + 1) : (count/this.pageSize);
			if(!this.pageLoaded){
				var me = this;
				this.pagebar.initialize();
				this.pagebar.bindWithMatrix(me,me.onPageChange,me.matrix);
				this.pagebar.setValue(this.currentPage, this.totalPages, this.pageSize, this.totalRecordCount);
				this.pageLoaded = true;
			}
		};
		
		query.prototype.onPageChange = function(msg) {
			this.currentPage = msg.currentPageNumber;
			this.loadInsideOrganList();
		};

		query.prototype.matrixSelected = function(mtx,strRECORDID){
			var parent = ux.megatron.Main.getServer().getBodyBlock();
			var me = this;
			var rec = mtx.getRecord(strRECORDID);
			ux.megatron.Main.loadUIResourceAsync(parent,"ux.cdb.admin","ux/cdb/admin/queries/insideOrgan/ui/detaildialog.xml",me, me.dialogLoaded);
		}
		
		query.prototype.dialogLoaded = function(objEvent){
		}

    });
}